feat: add two utility functions export_parquet and create_view and a vignette on how to materialize data.#1177
Open
nbc wants to merge 1 commit intoduckdb:mainfrom
Open
feat: add two utility functions export_parquet and create_view and a vignette on how to materialize data.#1177nbc wants to merge 1 commit intoduckdb:mainfrom
nbc wants to merge 1 commit intoduckdb:mainfrom
Conversation
…vignette * export_parquet uses COPY TO to export a parquet file from a tbl_lazy * create_view creates a view based on a tbl_lazy The vignette explains how to materialize data with those two functions and dbplyr::compute() Fixes duckdb#207, duckdb#630
b89ba2e to
a0fbed6
Compare
Collaborator
|
Thanks for the effort. The code looks good, I'm still not ready to assume maintenance for it. I labeled the issues as "help wanted" before duckplyr 1.1.0. Writing to Parquet works there: library(tidyverse)
library(duckdb)
#> Loading required package: DBI
con <- dbConnect(duckdb::duckdb())
dbWriteTable(con, "my_tbl", data.frame(a = 1))
dbplyr_tbl <- tbl(con, "my_tbl")
dbplyr_tbl %>%
duckplyr::as_duckdb_tibble() |>
duckplyr::compute_parquet("my_tbl.parquet")
#> # A duckplyr data frame: 1 variable
#> a
#> <dbl>
#> 1 1
duckplyr_parquet <-
duckplyr::read_parquet_duckdb("my_tbl.parquet")
duckplyr_parquet
#> # A duckplyr data frame: 1 variable
#> a
#> <dbl>
#> 1 1Created on 2025-06-17 with reprex v2.1.1 As for creating a view, dbplyr or a related package is a better fit, this functionality seems general enough to work across databases. I'd like to keep the package vignette-free for shorter build times. Otherwise, each Happy to see this code thrive elsewhere! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR add two utility functions :
The vignette explains how to materialize data using these two functions, as well as with the lesser-known dbplyr::compute() function.
Fixes #207, #630